package com.own.business.log.operation.persistence.entity.po;

import com.own.component.elastic.core.advanced.aop.ElasticFieldInteger;
import com.own.component.elastic.core.advanced.aop.ElasticFieldLong;
import com.own.component.elastic.core.advanced.aop.ElasticFieldObject;
import com.own.component.elastic.core.advanced.aop.ElasticFieldText;
import com.own.component.elastic.core.advanced.aop.ElasticFieldZonedDateTime;
import com.own.component.elastic.entity.BaseElasticPo;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import lombok.experimental.FieldNameConstants;

import java.io.Serializable;
import java.time.ZonedDateTime;

/**
 * LogOperationElasticPo
 *
 * @author chenxueli
 * @date 2023-08-09 10:24:19
 */
@Getter
@Setter
@ToString
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
@FieldNameConstants
public class LogOperationElasticPo extends BaseElasticPo<LogOperation> implements Serializable {

    @ElasticFieldText(name = "主键id", keyword = true)
    private String code;

    @ElasticFieldText(name = "响应信息")
    private String message;

    @ElasticFieldText(name = "登录令牌", keyword = true)
    private String token;

    @ElasticFieldLong(name = "用户id")
    private Long fkUserId;

    @ElasticFieldText(name = "用户名", keyword = true)
    private String userName;

    @ElasticFieldInteger(name = "状态 1=成功 2=失败")
    private Integer status;

    @ElasticFieldText(name = "方法名（全限定名）", keyword = true)
    private String methodName;

    @ElasticFieldText(name = "客户端", keyword = true)
    private String client;

    @ElasticFieldText(name = "ip", keyword = true)
    private String ip;

    @ElasticFieldText(name = "模块名称", keyword = true)
    private String moduleName;

    @ElasticFieldText(name = "操作名称", keyword = true)
    private String operationName;

    @ElasticFieldObject(name = "额外信息")
    private Object extra;

    @ElasticFieldZonedDateTime(name = "请求时间")
    private ZonedDateTime requestTime;

    @ElasticFieldText(name = "请求参数")
    private String requestParams;

    @ElasticFieldZonedDateTime(name = "响应时间")
    private ZonedDateTime responseTime;

    @ElasticFieldText(name = "响应参数")
    private String responseParams;

    @ElasticFieldText(name = "链路id", keyword = true)
    private String traceId;

    @ElasticFieldInteger(name = "等级")
    private Integer level;

    @ElasticFieldObject(name = "请求头")
    private Object headerParams;

    @ElasticFieldText(name = "请求地址")
    private String requestUrl;

    @ElasticFieldText(name = "请求方式")
    private String requestMethod;

    @ElasticFieldLong(name = "处理时间")
    private Long handleTime;

    @ElasticFieldText(name = "服务名称", keyword = true)
    private String service;

}
